<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改密码</title>
    <link rel="stylesheet" href="/static/css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/static/js/xadmin.js"></script>
</head>
<body>
<br><br>
<div class="layui-form-item">
    <label for="" class="layui-form-label">旧密码</label>
    <div class="layui-input-inline">
        <input type="password" id="oldpassword" class="layui-input">
    </div>
</div>
<div class="layui-form-item">
    <label for="" class="layui-form-label">新密码</label>
    <div class="layui-input-inline">
        <input type="password" id="newpassword" class="layui-input">
    </div>
</div>
<div class="layui-form-item">
    <label for="" class="layui-form-label">确认密码</label>
    <div class="layui-input-inline">
        <input type="password" id="newpassword1" class="layui-input">
    </div>
</div>
{if $Think.session.admin}
<input type="hidden" id="statu" value="1">
{else/}
<input type="hidden" id="statu" value="0">
{/if}
<div class="layui-form-item">
    <label for="" class="layui-form-label"></label>
    <div class="layui-input-inline">
        <button class="layui-btn" onclick="update()">修改</button>
    </div>
</div>
</body>
<script>
    function update() {
        $.post(
            "",
            {
                oldpassword:$("#oldpassword").val(),
                newpassword:$("#newpassword").val(),
                newpassword1:$("#newpassword1").val(),
                statu:$("#statu").val()
            },
            function (data) {
                if (data.statu==200){
                    layer.msg(data.msg);
                    $("#oldpassword").val('');
                    $("#newpassword").val('');
                    $("#newpassword1").val('');
                } else {
                    layer.msg(data.msg);
                }
            }
        )
    }
</script>
</html>